
var form_syslog_preinit = function(){
	$('#search_name').searchbox(
    {
       searcher:function(value,name)
       {  
            jQuery('#manage_link').datagrid('reload');
       } 
    }
    )
}

var form_onBeforeLoad = function(param)
{   
	jQuery(this).datagrid('options').url =__Manager_Link_BuildUrl() ;
};

function __Manager_Link_BuildUrl(){
	var url=__FormHelper_GetActionLink(); 
	var options=__FormHelper_GetGridObject().datagrid("options");
	var search_name=jQuery.trim(jQuery("#search_name").searchbox("getValue"));
    if(search_name!='')
    {
     url += "&search_name="+search_name;   
    }
	if (options.sortName != null)
	{
		url+="&sortName="+encodeURI(options.sortName)+"&sortOrder="+options.sortOrder;
	}
	return url;

}

function __FH_LL_Add()
{
    var src=__FormHelper_GetSrc();
    var url="/index.php?module=documentsmodule&action=edit&src="+src;
    window.location.href=url;
}

function __FH_LL_Edit(table_selector){
    
    var node = __FormHelper_GetGridObject().datagrid('getSelected');
    if (node){
        var url="/index.php?module=documentsmodule&action=edit&id="+node.id+"&src="+__FormHelper_GetSrc();
        window.location=url;
    }
    // 
}

function __AB_PDoremi_CityManager_Remove(){
    
   var node = __FormHelper_GetGridObject().datagrid('getSelected');
   var temp=Math.random()*9999;
    if (node){
        if (!confirm("Are you sure deleting this item?"))
            return;
        // call ajax
        jQuery.post("/index.php", {
            module: 'documentsmodule',
            action: 'delete',
            ajax_action: '1',
            id: node.id,
            src: __FormHelper_GetSrc(),
            t: temp
        }, function(param)
        {
            __FormHelper_GetGridObject().datagrid('reload');
        }
        );
       __FormHelper_GetGridObject().datagrid('clearSelections');
    }
}

function __LinkList_Manage_Switch(way){
    var node = __FormHelper_GetGridObject().datagrid('getSelected');
    var temp=Math.random()*9999;
    if (node){
        jQuery.post("/index.php", {
            module: 'documentsmodule',
            action: 'item_rankSwitch',
            ajax_action: '1',
            id: node.id,
            src: __FormHelper_GetSrc(),
            stype:way,
            t: temp

        }, function(param)
        {
            __FormHelper_GetGridObject().datagrid('reload');
        }
        );
        __FormHelper_GetGridObject().datagrid('clearSelections');
    }
}
